using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;

namespace Pegasus.Web.UI
{
	/// <summary>
	/// 
	/// </summary>
	public class UserControlEx : UserControl
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="T:UserControlEx"/> class.
		/// </summary>
		public UserControlEx()
		{
		}

		/// <summary>
		/// Raises the load event.
		/// </summary>
		/// <param name="args">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
		protected override void OnLoad( EventArgs args )
		{
			base.OnLoad( args );

			if( !IsPostBack )
			{
				OnLoadFirstTime( args );
			}
			else
			{
				OnLoadPostBack( args );
			}

			OnLoadFinish( args );
		}

		/// <summary>
		/// Called the load first time the page is loaded (not a post back).
		/// </summary>
		/// <param name="args">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
		protected virtual void OnLoadFirstTime( EventArgs args )
		{
		}

		/// <summary>
		/// Called when the page is posted back to.
		/// </summary>
		/// <param name="args">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
		protected virtual void OnLoadPostBack( EventArgs args )
		{
		}

		/// <summary>
		/// Called at the end of the load process.
		/// </summary>
		/// <param name="args">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
		protected virtual void OnLoadFinish( EventArgs args )
		{
		}
	}
}
